<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class AgenceModel
{
    public function getAll()
    {
        $req = $GLOBALS['db']->prepare("SELECT id, nom, adresse, adresse_suite, codepostal, ville, telephone, fax, email, photo FROM ". PREFIX ."agence ORDER BY nom");
        $req->execute();

        return $req->fetchAll();
    }

    public function getById($agence_id)
    {
        $req = $GLOBALS['db']->prepare("SELECT id, nom, adresse, adresse_suite, codepostal, ville, telephone, fax, email, photo FROM ". PREFIX ."agence WHERE id = :agence_id LIMIT 1");
        $req->bindParam('agence_id', $agence_id, PDO::PARAM_INT);
        $req->execute();

        $agence = $req->fetch();

        $req->closeCursor();

        return $agence;
    }
}

?>
